<pre>
<?php
/*
$bool = true;
$i = 1;
while ($bool) {
	if ($ch = curl_init('http://treaties.un.org/doc/Publication/MTDSG/Volume%20I/Chapter%20IV/IV-' . $i . '.en.xml')) {
		$content=simplexml_load_file('http://treaties.un.org/doc/Publication/MTDSG/Volume%20I/Chapter%20IV/IV-' . $i . '.en.xml');
		echo $i . '<br />';
		$i++;
	} else {
		$bool = false;
	}
}*/
  
  $i = 1;
  while (@fopen('http://treaties.un.org/doc/Publication/MTDSG/Volume%20I/Chapter%20IV/IV-' . $i . '.en.xml', "r")) {
  	$xml = simplexml_load_file('http://treaties.un.org/doc/Publication/MTDSG/Volume%20I/Chapter%20IV/IV-' . $i . '.en.xml');
  	$doc = new DOMDocument();
	  $doc->load('http://treaties.un.org/doc/Publication/MTDSG/Volume%20I/Chapter%20IV/IV-' . $i . '.en.xml');
	  $arrFeeds = array();
	  echo $i . '. ' . $doc->getElementsByTagName('Titlesect')->item(0)->nodeValue . '<br />';
	  foreach ($doc->getElementsByTagName('Chapter') as $node) {
	    $itemRSS = array ( 
	      'header' => $node->getElementsByTagName('Header')->item(0)->nodeValue,
	      'title' => $node->getElementsByTagName('Name')->item(0)->nodeValue,
	      );
	    array_push($arrFeeds, $itemRSS);
	    echo '$itemRSS = ';
	    var_dump($itemRSS);
	  }
	  foreach ($doc->getElementsByTagName('ExternalData') as $node) {
	  	$itemRSS = array(
	  		'title' => $node->getElementsByTagName('Titlesect')->item(0)->nodeValue,
	  		'conclusion' => $node->getElementsByTagName('Conclusion')->item(0)->nodeValue,
	  	);
	    array_push($arrFeeds, $itemRSS);
	    echo '$itemRSS = ';
	    var_dump($itemRSS);
	  }
	  echo '$arrFeeds = ';
	  var_dump($arrFeeds);
/*	  $documentObject = $xml->Document;
	  foreach ($documentObject as $document) {
	  	echo 'document = ';
	  	var_dump($document);
	  	$treatyObject = $document->Treaty;
	  	foreach ($treatyObject as $treaty) {
		  echo '$treaty = ';
		  var_dump($treaty);
	  	}
	  }
	  $participants = $treaty->Participants;
	  $table = $participants->Table;
	  $tGroup = $table->TGroup;
	  $tBody = $tGroup->TBody;*/
	  $i++;
  }

?>
</pre>